{% extends "forum/base.html" %}
{% comment %}
<!--
  Copyright (C) 2008 ZHENG Zhong <heavyzheng nospam-at gmail D0T com>
  - http://heavyz.blogspot.com/
  - http://buggarden.blogspot.com/

  The forum thread page. This page displays the thread and a list of replies. The thread is
  displayed inside a div block with ID "thread_{{ thread.key.id }}"; the replies are displayed
  inside a div block with ID "reply_{{ reply.key.id }}".

  Created on 2008-05-07.
  $Id: view_thread.html 252 2008-10-28 11:06:08Z heavyzheng $
-->
{% endcomment %}

{#------------------------------------------------------------------------------------------------#}

{% block html_head %}

<title>{{ thread.title|escape }} :: {{ thread.board.name|escape }} :: Bug Garden Forum</title>

<script type="text/javascript">//<![CDATA[

  function closeMessage() {
    $(".message").hide("slow");
  }
  
  function showReplyForm(id) {
    $(id + " .form-toggles"  ).hide();
    $(id + " .submitting"    ).hide();
    $(id + " .form"          ).hide();
    $(id + " .post-content"  ).show("slow");
    $(id + " .reply-form"    ).show("slow");
  }
  
  function showEditForm(id) {
    $(id + " .post-content"  ).hide();
    $(id + " .form-toggles"  ).hide();
    $(id + " .submitting"    ).hide();
    $(id + " .form"          ).hide();
    $(id + " .edit-form"     ).show("slow");
  }
  
  function showRecommendForm(id) {
    $(id + " .form-toggles"  ).hide();
    $(id + " .submitting"    ).hide();
    $(id + " .form"          ).hide();
    $(id + " .post-content"  ).show("slow");
    $(id + " .recommend-form").show("slow");
  }
  
  function showLockForm(id) {
    $(id + " .form-toggles"  ).hide();
    $(id + " .submitting"    ).hide();
    $(id + " .form"          ).hide();
    $(id + " .post-content"  ).show("slow");
    $(id + " .lock-form"     ).show("slow");
  }
  
  function showDeleteForm(id) {
    $(id + " .form-toggles"  ).hide();
    $(id + " .submitting"    ).hide();
    $(id + " .form"          ).hide();
    $(id + " .post-content"  ).show("slow");
    $(id + " .delete-form"   ).show("slow");
  }
  
  function cancelAction(id) {
    $(id + " .submitting"    ).hide();
    $(id + " .form"          ).hide();
    $(id + " .post-content"  ).show("slow");
    $(id + " .form-toggles"  ).show("slow");
  }

  function submitReplyForm(id) {
    $(id + " .form-toggles"  ).hide();
    $(id + " .form"          ).hide();
    $(id + " .post-content"  ).show("slow");
    $(id + " .submitting"    ).show("slow");
    
    var data = $(id + " .reply-form").serialize();
    var url  = $(id + " .reply-form").attr("action");
    var options = {
      type    : "POST",
      url     : url,
      data    : data,
      success : function(data) {
        $(id).after(data).remove();
      }
    }
    $.ajax(options);
  }

  function submitEditForm(id) {
    $(id + " .post-content"  ).hide();
    $(id + " .form-toggles"  ).hide();
    $(id + " .form"          ).hide();
    $(id + " .submitting"    ).show("slow");
    
    var data = $(id + " .edit-form").serialize();
    var url  = $(id + " .edit-form").attr("action");
    var options = {
      type    : "POST",
      url     : url,
      data    : data,
      success : function(data) {
        $(id).after(data).remove();
      }
    }
    $.ajax(options);
  }

  function submitRecommendForm(id) {
    $(id + " .form-toggles"  ).hide();
    $(id + " .form"          ).hide();
    $(id + " .post-content"  ).show("slow");
    $(id + " .submitting"    ).show("slow");
    
    var data = $(id + " .recommend-form").serialize();
    var url  = $(id + " .recommend-form").attr("action");
    var options = {
      type    : "POST",
      url     : url,
      data    : data,
      success : function(data) {
        $(id).after(data).remove();
      }
    }
    $.ajax(options);
  }

  function submitLockForm(id) {
    $(id + " .form-toggles"  ).hide();
    $(id + " .form"          ).hide();
    $(id + " .post-content"  ).show("slow");
    $(id + " .submitting"    ).show("slow");
    
    var data = $(id + " .lock-form").serialize();
    var url  = $(id + " .lock-form").attr("action");
    var options = {
      type    : "POST",
      url     : url,
      data    : data,
      success : function(data) {
        $(id).after(data).remove();
      }
    }
    $.ajax(options);
  }

  function submitDeleteForm(id) {
    $(id + " .form-toggles"  ).hide();
    $(id + " .form"          ).hide();
    $(id + " .post-content"  ).show("slow");
    $(id + " .submitting"    ).show("slow");
    
    var data = $(id + " .delete-form").serialize();
    var url  = $(id + " .delete-form").attr("action");
    var options = {
      type    : "POST",
      url     : url,
      data    : data,
      success : function(data) {
        $(id).after(data).remove();
      }
    }
    $.ajax(options);
  }

//]]></script>

{% endblock %}{# html_head #}

{#------------------------------------------------------------------------------------------------#}

{% block header %}
<div class="title">{{ thread.board.name|escape }}</div>
{% endblock %}{# header #}

{#------------------------------------------------------------------------------------------------#}

{% block navbar %}

<img src="/static/forum/images/home_icon.png" alt="Bug Garden Forum"/>
<a href="/forum/">Forum Home</a>
&#187;
<img src="/static/forum/images/board_icon.png" alt="Board"/>
<a href="/forum/board/{{ thread.board.key.id }}/">{{ thread.board.name|escape }}</a>
&#187;
<img src="/static/forum/images/thread_icon.png" alt="Thread"/>
{{ thread.title|escape }}

{% endblock %}{# navbar #}

{#------------------------------------------------------------------------------------------------#}

{% block content %}


<div class="section">

  {% include "forum/sections/thread.html" %}

  {% for reply in replies %}
    {% include "forum/sections/reply.html" %}
  {% endfor %}

</div><!--/.section-->


{% endblock %}{# content #}




